package cn.com.b2office.service.impl;

import java.util.ArrayList;
import java.util.List;

import cn.com.b2office.bean.ItemQueryParam;
import cn.com.b2office.dao.ItemDao;
import cn.com.b2office.dao.SpecialItemDao;
import cn.com.b2office.domain.Item;
import cn.com.b2office.domain.SpecialItem;
import cn.com.b2office.service.ItemService;

public class ItemServiceImpl implements ItemService {

	private SpecialItemDao specialItemDao = null;

	private ItemDao itemDao = null;

	public void setItemDao(ItemDao itemDao) {
		this.itemDao = itemDao;
	}

	public void setSpecialItemDao(SpecialItemDao specialItemDao) {
		this.specialItemDao = specialItemDao;
	}

	public List<SpecialItem> findSpecialItems(int sectionId, int firstResult,
			int maxResults) {

		return specialItemDao.listItems(sectionId, firstResult, maxResults);
	}

	public List<Item> findItems(List<String> itemIdList) {
		if (itemIdList == null || itemIdList.isEmpty())
			return new ArrayList<Item>();
		return itemDao.findSpecialItems(itemIdList);
	}

	public Item getItem(String itemId) {
		return itemDao.getItem(itemId);
	}

	public List<Item> queryItems(ItemQueryParam param) {
		return itemDao.queryItems(param);
	}

	public int size(ItemQueryParam param) {
		return itemDao.size(param);
	}

	public List<Item> findItemsByIterate(List<String> itemIdList) {
		return itemDao.findItemsByIterate(itemIdList);
	}

}
